package com.leo;

import java.beans.PropertyChangeSupport;

/**
 * @ClassName Student
 * @Description
 * @Author wangss
 * @date 2020.05.24 22:31
 * @Version 1.0
 */
public class Student {

    private String name;

    private int age;

    private double score;

    public PropertyChangeSupport pc = new PropertyChangeSupport(this);

    public Student(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        String oldValue = this.name;
        this.name = name;
        pc.firePropertyChange("setName_pc", oldValue, this.name);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        int oldValue = this.age;
        this.age = age;
        pc.firePropertyChange("setAge_pc", oldValue, this.age);
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }
}
